package interfaces.menu.joinGame.filters;

import interfaces.menu.joinGame.gamesTable.GamesTableWidget;
import interfaces.options.TextEditorOptionWidget;

public class MaxPingFilter extends Filter {
	
	private TextEditorOptionWidget textEditor;
	
	public MaxPingFilter(TextEditorOptionWidget filterWidget) {
		super(filterWidget);
		textEditor = filterWidget;
	}
	
	@Override
	public boolean passes(GamesTableWidget widget) {
		int ping = widget.getPing();
		int value = Integer.valueOf(textEditor.getValue()).intValue();
		return ping <= value;
	}
}